<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta name="format-detection" content="telephone=no"/>
<meta name="wap-font-scale" content="no">
<meta name="renderer" content="webkit">
<title>AutoCode</title>
<link rel="shortcut icon" href="/favicon.ico" />
<script src="/links/jquery/jquery-3.5.1.min.js"></script>
<script src="/links/polyfill.min.js"></script>
<script src="/links/axios/axios.min.js"></script>
<script src="/links/vue/vue.min.js"></script>
<script src="/links/element-ui/index.js"></script>
<script src="/links/dayjs.min.js"></script>
<script src="/links/echarts/echarts.js"></script>
<script src="/links/JsBarcode.all.js"></script>
<script src="/links/qrcode.min.js"></script>
<script src="/links/layer/layer.js"></script>
<script src="/links/crypto/crypto-js.js"></script>
<script src="/js/dragController.js"></script>
<script src="/js/HttpApi.js"></script>
<script src="/js/AutoCode.js"></script>
<link href="/links/element-ui/theme/index.css" rel="stylesheet"/>
<link href="/css/default.css" rel="stylesheet"/>
<link href="/css/dragController.css" rel="stylesheet"/>
    
    <style>
        
    </style>
</head>
<body>
<div id="app"  class="box " >
<div class="left " style="width:400px;">
<div class="flex ac-table-head">
    <div></div>
    <div class="ac-table-oper"><el-button size="medium"  v-if="sysRoles.operVisible.add==undefined || sysRoles.operVisible.add" @click="sysRoles_openAddSysRole()" :disabled="sysRoles.operDisabled.add"  type="text"     native-type="button">添加(A)</el-button>
<el-button size="medium"  v-if="sysRoles.operVisible.edit==undefined || sysRoles.operVisible.edit" @click="sysRoles_editAddSysRole()" :disabled="sysRoles.operDisabled.edit"  type="text"     native-type="button">编辑(E)</el-button>
<el-button size="medium"  v-if="sysRoles.operVisible.del==undefined || sysRoles.operVisible.del" @click="sysRoles_sysRolesDel()" :disabled="sysRoles.operDisabled.del"  type="text"     native-type="button">删除(D)</el-button>
<el-button size="medium"  v-if="sysRoles.operVisible.query==undefined || sysRoles.operVisible.query" @click="sysRoles_load()" :disabled="sysRoles.operDisabled.query"  type="text"     native-type="button">刷新(Q)</el-button>
</div>
</div>
<div class="ac-table-content">
    <el-table row-key="id" highlight-current-row stripe show-header    border  
    :data="sysRoles.data" size="mini" ref="sysRoles"
       
    height="100%"
    @current-change="sysRoles_currentChange">
    <el-table-column type="index" width="50" label="序号"></el-table-column>
<el-table-column prop="label" label="角色名称"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.label}}
   </template>
</el-table-column>
<el-table-column prop="isDefault" label="默认角色" width="80"   align="center"  show-overflow-tooltip class-name="editorCell">
   <template slot-scope="scope">
        <el-checkbox  v-model="scope.row.isDefault"  size="small"  true-label="Y"  false-label="N" disabled ></el-checkbox>

   </template>
</el-table-column>
<el-table-column prop="isPublic" label="公共角色"    align="center"  show-overflow-tooltip class-name="editorCell">
   <template slot-scope="scope">
        <el-checkbox  v-model="scope.row.isPublic"  size="small"  true-label="Y"  false-label="N" disabled ></el-checkbox>

   </template>
</el-table-column>

</el-table>

</div>

</div>
<div class="resize"></div>
<div class="right " style="width:calc(100% - 402px);">
<el-tabs type="border-card" v-model="page.tabs" class=""  >
<el-tab-pane class="" label="PC端授权" name="tab1" :disabled="tabDisabled.tab1" v-if="tabVisible.tab1" >
<div class="flex ac-tree-head ac-tree-head-default-line">
    <div class="ac-tree-title"></div>
    <div class="ac-tree-oper">
        <el-button size="medium"  v-if="sysRoleMenus.operVisible.ele_00111==undefined || sysRoleMenus.operVisible.ele_00111" @click="sysRoleMenus_save()" :disabled="sysRoleMenus.operDisabled.ele_00111"  type="text"     native-type="button">保存</el-button>

    </div>
</div>
<div class="ac-tree-content">
    <el-tree ref="sysRoleMenus" :data="sysRoleMenus.data"
    :expand-on-click-node="false" node-key="id" empty-text="内容为空"
       
    show-checkbox  :default-checked-keys="sysRoleMenus.defaultCheckedKeys" 
    
      
       
    @check="sysRoleMenus_check"
    @current-change="sysRoleMenus_currentChange"
    >
    <span class="custom-tree-node" slot-scope="{ node, data }">
    <span>
        {{ data.name }}
    </span>
    <span>
    </span>
</span>

</el-tree>

</div>
</el-tab-pane>
<el-tab-pane class="" label="APP端授权" name="tab3" :disabled="tabDisabled.tab3" v-if="tabVisible.tab3" >
<div class="flex ac-tree-head ac-tree-head-default-line">
    <div class="ac-tree-title"></div>
    <div class="ac-tree-oper">
        <el-button size="medium"  v-if="appRoleMenus.operVisible.ele_00111==undefined || appRoleMenus.operVisible.ele_00111" @click="appRoleMenus_save()" :disabled="appRoleMenus.operDisabled.ele_00111"  type="text"     native-type="button">保存</el-button>

    </div>
</div>
<div class="ac-tree-content">
    <el-tree ref="appRoleMenus" :data="appRoleMenus.data"
    :expand-on-click-node="false" node-key="id" empty-text="内容为空"
       
    show-checkbox  :default-checked-keys="appRoleMenus.defaultCheckedKeys" 
    
      
       
    @check="appRoleMenus_check"
    @current-change="appRoleMenus_currentChange"
    >
    <span class="custom-tree-node" slot-scope="{ node, data }">
    <span>
        {{ data.name }}
    </span>
    <span>
    </span>
</span>

</el-tree>

</div>
</el-tab-pane>
<el-tab-pane class="" label="角色用户" name="tab2" :disabled="tabDisabled.tab2" v-if="tabVisible.tab2" >
<div class="flex ac-table-head">
    <div></div>
    <div class="ac-table-oper"><el-form :inline="true" label-position="left" :model="sysRoleUsers.operData" size="mini" class="searchForm" @submit.native.prevent="sysRoleUsers_load">
<el-form-item v-if="sysRoleUsers.operVisible.keyWord==undefined || sysRoleUsers.operVisible.keyWord"><el-input type="text" v-model="sysRoleUsers.operData.keyWord" clearable placeholder="中文名/邮箱/手机号"  @keyup.enter.native="sysRoleUsers_load"></el-input>
</el-form-item>
<el-form-item v-if="sysRoleUsers.operVisible.ele_00115==undefined || sysRoleUsers.operVisible.ele_00115"><el-button size="medium"  v-if="sysRoleUsers.operVisible.ele_00115==undefined || sysRoleUsers.operVisible.ele_00115" @click="sysRoleUsers_load()" :disabled="sysRoleUsers.operDisabled.ele_00115"  type="text"     native-type="button">刷新(Q)</el-button>
</el-form-item>
<el-form-item v-if="sysRoleUsers.operVisible.C==undefined || sysRoleUsers.operVisible.C"><el-button size="medium"  v-if="sysRoleUsers.operVisible.C==undefined || sysRoleUsers.operVisible.C" @click="sysRoleUsers_openSelectRoleUser()" :disabled="sysRoleUsers.operDisabled.C"  type="text"     native-type="button">用户授权(A)</el-button>
</el-form-item>
<el-form-item v-if="sysRoleUsers.operVisible.buttonD==undefined || sysRoleUsers.operVisible.buttonD"><el-button size="medium"  v-if="sysRoleUsers.operVisible.buttonD==undefined || sysRoleUsers.operVisible.buttonD" @click="sysRoleUsers_delete()" :disabled="sysRoleUsers.operDisabled.buttonD"  type="text"     native-type="button">删除用户(D)</el-button>
</el-form-item>

</el-form>
</div>
</div>
<div class="ac-table-content2">
    <el-table row-key="id" highlight-current-row stripe show-header    border  
    :data="sysRoleUsers.data" size="mini" ref="sysRoleUsers"
       
    height="100%"
    @current-change="sysRoleUsers_currentChange">
    <el-table-column type="selection" width="50" align="center"></el-table-column>
<el-table-column type="index" width="50" label="序号"></el-table-column>
<el-table-column prop="username" label="用户账号"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.username}}
   </template>
</el-table-column>
<el-table-column prop="fullname" label="中文名"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.fullname}}
   </template>
</el-table-column>
<el-table-column prop="email" label="邮箱"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.email}}
   </template>
</el-table-column>
<el-table-column prop="phone" label="电话"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.phone}}
   </template>
</el-table-column>
<el-table-column prop="status" label="用户状态"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        <template v-for="dict in dictOptions.userStatus" v-if="scope.row.status==dict.value"> <i :style="{color:dict.iconColor}" :class="dict.icon"></i> <label :style="{color:dict.fontColor}">{{dict.label}}</label></template>
   </template>
</el-table-column>

</el-table>

</div>
<div class="flex">
    <div></div>
    <div> <el-pagination
      @size-change="sysRoleUsers_pageSizeChange"
      @current-change="sysRoleUsers_pageCurrentChange"
      :current-page="sysRoleUsers.pagingData.currentPage"
      :page-sizes="sysRoleUsers.pagingData.pageSizes"
      :page-size="sysRoleUsers.pagingData.pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="sysRoleUsers.pagingData.total"
       
      >
    </el-pagination>
</div>
</div>
</el-tab-pane>

</el-tabs>

</div>

<el-dialog :visible.sync="addSysRole.visible" :title="addSysRole.title"
            width="400px"
                
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div style="width:100%;">
                <el-form class=""    label-width="80px" label-position="right"
     size="mini" ref="addSysRole" :model="addSysRole.data" :rules="addSysRole.rules"  
     :disabled="addSysRole.disabled" @submit.native.prevent>
    <el-row><el-col :span=24 v-if="addSysRole.itemVisible.label==undefined || addSysRole.itemVisible.label">
    <el-form-item prop="label" label="角色名称">
        
<el-input type="text" size="mini"  v-model="addSysRole.data.label" placeholder="角色名称" :disabled="addSysRole.itemDisabled.label"  @keyup.enter.native="addSysRole_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="addSysRole.itemVisible.isDefault==undefined || addSysRole.itemVisible.isDefault">
    <el-form-item prop="isDefault" label="默认角色">
        <el-checkbox  v-model="addSysRole.data.isDefault"  size="mini"  true-label="Y"  false-label="N" :disabled="addSysRole.itemDisabled.isDefault"  @keyup.enter.native="addSysRole_dialogOk"></el-checkbox>

        
    </el-form-item>
</el-col>
</el-row>
 </el-form>

            </div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="addSysRole_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="addSysRole_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="selectRoleUser.visible" :title="selectRoleUser.title"
            width="50%"
                
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div style="width:100%;height:400px;">
                <div class="flex ac-table-head">
    <div class="ac-table-oper"><el-form :inline="true" label-position="left" :model="selectRoleUser.operData" size="mini" class="searchForm" @submit.native.prevent="selectRoleUser_load">
<el-form-item v-if="selectRoleUser.operVisible.keyWord==undefined || selectRoleUser.operVisible.keyWord"><el-input type="text" v-model="selectRoleUser.operData.keyWord" clearable placeholder="中文名/邮箱/手机号"  @keyup.enter.native="selectRoleUser_load"></el-input>
</el-form-item>
<el-form-item v-if="selectRoleUser.operVisible.query==undefined || selectRoleUser.operVisible.query"><el-button size="medium"  v-if="selectRoleUser.operVisible.query==undefined || selectRoleUser.operVisible.query" @click="selectRoleUser_()" :disabled="selectRoleUser.operDisabled.query"  type="text"     native-type="button">查询(Q)</el-button>
</el-form-item>

</el-form>
</div>
    <div></div>
</div>
<div class="ac-table-content2">
    <el-table row-key="id" highlight-current-row stripe show-header    border  
    :data="selectRoleUser.data" size="mini" ref="selectRoleUser"
       
    height="100%"
    @current-change="selectRoleUser_currentChange">
    <el-table-column type="selection" width="50" align="center"></el-table-column>
<el-table-column type="index" width="50" label="序号"></el-table-column>
<el-table-column prop="username" label="用户名"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.username}}
   </template>
</el-table-column>
<el-table-column prop="fullname" label="用户全名"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.fullname}}
   </template>
</el-table-column>
<el-table-column prop="email" label="邮箱"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.email}}
   </template>
</el-table-column>
<el-table-column prop="phone" label="电话"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.phone}}
   </template>
</el-table-column>

</el-table>

</div>
<div class="flex">
    <div></div>
    <div> <el-pagination
      @size-change="selectRoleUser_pageSizeChange"
      @current-change="selectRoleUser_pageCurrentChange"
      :current-page="selectRoleUser.pagingData.currentPage"
      :page-sizes="selectRoleUser.pagingData.pageSizes"
      :page-size="selectRoleUser.pagingData.pageSize"
      layout="total, sizes, prev, pager, next"
      :total="selectRoleUser.pagingData.total"
       
      >
    </el-pagination>
</div>
</div>
            </div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="selectRoleUser_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="selectRoleUser_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>


</div>

</body>
<script th:inline="javascript">
    let vm = new Vue({
            el: '#app',
            data() {
                return {"sysRoleMenus":{"title":"角色菜单","data":[],"defaultCheckedKeys":[],"currentNodeKey":{},"operData":{"ele_00111":""},"operVisible":{},"operDisabled":{},"currentRow":{}},"appRoleMenus":{"title":"APP端授权","data":[],"defaultCheckedKeys":[],"currentNodeKey":{},"operData":{"ele_00111":""},"operVisible":{},"operDisabled":{},"currentRow":{}},"sysRoles":{"title":"角色清单","currentRow":{},"data":[],"expandRowKeys":[],"pagingData":{},"operData":{"query":"","edit":"","add":"","del":""},"operVisible":{},"operDisabled":{},"rawData":[],"itemVisible":{},"operDialogVisible":false},"sysRoleUsers":{"title":"角色对应用户","currentRow":{},"data":[],"expandRowKeys":[],"pagingData":{"currentPage":1,"total":0,"pageSize":20,"pageSizes":[10,20,30,40,50,100]},"operData":{"keyWord":"","ele_00115":"","C":"","buttonD":""},"operVisible":{},"operDisabled":{},"rawData":[],"itemVisible":{},"operDialogVisible":false},"page":{"tabs":"tab1"},"tabDisabled":{"tab1":false,"tab3":false,"tab2":false},"tabVisible":{"tab1":true,"tab3":true,"tab2":true},"customOptions":{},"dictOptions":{},"addSysRole":{"visible":false,"title":"添加角色","data":{"isDefault":"N"},"operData":{},"operVisible":{},"operDisabled":{},"disabled":false,"editorForm":true,"itemVisible":{},"itemDisabled":{},"transfer":{},"rules":{"label":[{"required":true,"message":"请输入角色名称","trigger":"blur"},{"trigger":"blur","max":20,"min":1,"message":"长度在 1 到 20 个字符"}]}},"selectRoleUser":{"visible":false,"title":"选择用户","currentRow":{},"data":[],"expandRowKeys":[],"pagingData":{"currentPage":1,"total":0,"pageSize":20,"pageSizes":[10,20,30,40,50,100]},"operData":{"keyWord":"","query":""},"operVisible":{},"operDisabled":{},"rawData":[],"itemVisible":{},"operDialogVisible":false}}
            },
            watch: {
},
            methods: {
sysRoleMenus_load:function() {
    let that = this;
    HttpApi.queryDs("platformRole.roleMenus", that.sysRoleMenus.operData, function(res) {
        that.sysRoleMenus.data = res.data;
        that.sysRoleMenus.defaultCheckedKeys = res.defaultCheckedKeys;
        that.sysRoleMenus_operCtrl(res.isPublic);
    });
},
sysRoleUsers_load:function() {
    let that = this;
    let param = {};
    param.pagingData = this.sysRoleUsers.pagingData;
    param.operData = this.sysRoleUsers.operData;
    HttpApi.queryDs("platformRole.roleUsers", param, function(res) {
        that.sysRoleUsers.pagingData = res.pagingData;
        that.sysRoleUsers.data = res.data;
        if (res.data.length > 0) {
            that.$refs.sysRoleUsers.setCurrentRow(res.data[0]);
        }
    });
},
appRoleMenus_load:function() {
    let that = this;
    HttpApi.queryDs("platformRole.appRoleMenus", that.appRoleMenus.operData, function(res) {
        that.appRoleMenus.data = res.data;
        that.appRoleMenus.defaultCheckedKeys = res.defaultCheckedKeys;
        that.appRoleMenus_operCtrl(res.isPublic);
    });
},
sysRoles_currentChange:function(currentRow){
    if(currentRow){
        this.sysRoles.currentNodeKey=currentRow.id;
        this.sysRoles.currentRow = currentRow;
            this.sysRoleUsers.operData.roleId=this.sysRoles.currentRow.id;
this.sysRoleUsers_load();
    this.appRoleMenus.operData.roleId=this.sysRoles.currentRow.id;
this.appRoleMenus_load();
    this.sysRoleMenus.operData.roleId=this.sysRoles.currentRow.id;
this.sysRoleMenus_load();

    }else{
        this.$data.sysRoles.currentNodeKey=this.$options.data().sysRoles.currentNodeKey;
        this.$data.sysRoles.currentRow = this.$options.data().sysRoles.currentRow;
        this.$data.sysRoleUsers.operData=this.$options.data().sysRoleUsers.operData;
this.$data.sysRoleUsers.data=this.$options.data().sysRoleUsers.data;
this.$data.appRoleMenus.operData=this.$options.data().appRoleMenus.operData;
this.$data.appRoleMenus.data=this.$options.data().appRoleMenus.data;
this.$data.sysRoleMenus.operData=this.$options.data().sysRoleMenus.operData;
this.$data.sysRoleMenus.data=this.$options.data().sysRoleMenus.data;

    }
    this.sysRoles_operCtrl(currentRow);
},
selectRoleUser_delete:function() {
    let that = this;
    let selection = that.$refs.selectRoleUser.selection;
    let selLength = selection.length;
    if (selLength == 0) {
        that.$alert("请勾选要操作的数据");
        return;
    }
    HttpApi.delBatchProviderConfirm("sysOrganUsers", selection, function(res) {
        for (let i = 0; i < selLength; i++) {
            let index = that.selectRoleUser.data.findIndex(function(item) {
                return item.id == selection[i].id;
            });
            that.selectRoleUser.data.splice(index, 1);
        }

        if (that.selectRoleUser.data.length == 0) {
            that.$data.selectRoleUser.currentRow = that.$options.data().selectRoleUser.currentRow;
            that.$refs.selectRoleUser.setCurrentRow();
        } else {
            that.$refs.selectRoleUser.setCurrentRow(that.selectRoleUser.data[0]);
        }
        that.$message.success("删除成功");
    });
},
appRoleMenus_save:function(param) {
    let that = this;
    if (!this.sysRoles.currentRow.id) {
        this.$alert("没有对应的角色");
        return;
    }
    let checkedKeys = this.$refs.appRoleMenus.getCheckedKeys();

    HttpApi.post("/platform/roles/saveAppRoleMenus", {
        "roleId": this.sysRoles.currentRow.id,
        "checkedKeys": checkedKeys
    }, function(res) {
        /*请补充方法信息*/
        that.$message.success("保存成功！");
    });
},
addSysRole_dialogCancel:function(){
     this.addSysRole.visible = false;
},
appRoleMenus_operCtrl:function(isPublic) {
    /**
     * operDisabled：控制按钮的是否禁止操作，true代表禁止操作，false代表允许操作
     * this.$set(this.stdSolReceiveHistory.operDisabled, "buttonE", true);
     * operVisible：控制按钮是否显示，true代表显示，false代表不显示
     * this.$set(this.stdSolReceiveHistory.operVisible, "buttonE", false);
     */
    this.$set(this.appRoleMenus.operDisabled, "ele_00111", isPublic); 
},
sysRoleUsers_openSelectRoleUser:function() {
    let that = this;
    if (!this.sysRoles.currentRow.id) {
        this.$alert("请先选中一条角色清单信息");
        return;
    } else {
        this.selectRoleUser_dialogOpen(this.sysRoleUsers.operData, function(dialogData) {
            dialogData.forEach(function(item, index) {
                if (item.id) {
                    delete item.id;
                }
                item.roleId = that.sysRoleUsers.operData.roleId;
            });
            HttpApi.saveBatchProvider("sysRoleUsers", dialogData, function(res) {
                that.selectRoleUser.visible = false;
                that.sysRoleUsers_load();
            });
        })
    }
},
sysRoleUsers_delete:function(){
    let that = this;
    let selection = that.$refs.sysRoleUsers.selection;
    let selLength = selection.length;
    if(selLength==0){
       that.$alert("请选择要删除的数据");
       return;
    }
    HttpApi.delBatchProviderConfirm("sysRoleUsers",selection,function(res){
        for(let i=0;i<selLength;i++){
          let index = that.sysRoleUsers.data.findIndex(function(item){
             return item.id==selection[i].id;
          });
          that.sysRoleUsers.data.splice(index,1);
        }

        if(that.sysRoleUsers.data.length==0){
           that.$data.sysRoleUsers.currentRow = that.$options.data().sysRoleUsers.currentRow;
           that.$refs.sysRoleUsers.setCurrentRow();
        }else{
           that.$refs.sysRoleUsers.setCurrentRow(that.sysRoleUsers.data[0]);
        }
        that.$message.success("删除成功");
    });
}
,
addSysRole_dialogOk:function(){
      let that = this;
      this.$refs.addSysRole.validate(function(valid){
           if(valid){
                that.addSysRole.callback(that.addSysRole.data);
           }else{
                return false;
           }
      });
},
selectRoleUser_pageCurrentChange:function(currentPage){
    this.selectRoleUser.pagingData.currentPage=currentPage;
    this.selectRoleUser_load();
}
,
selectRoleUser_pageSizeChange:function(pageSize){
    this.selectRoleUser.pagingData.pageSize=pageSize;
    this.selectRoleUser_load();
}
,
sysRoleMenus_allowDrag:function(node){
    
},
selectRoleUser_dialogOk:function(){
      let that = this;
      let selection = that.$refs.selectRoleUser.selection;
      let selLength = selection.length;
      if(selLength==0){
          that.$alert("请至少选择一条数据!");
          return;
      }else{
          this.selectRoleUser.callback(selection);
      }
},
appRoleMenus_allowDrag:function(node){
    
},
sysRoleUsers_operCtrl:function(currentRow) {
    /**
    * operDisabled：控制按钮的是否禁止操作，true代表禁止操作，false代表允许操作
    * this.$set(this.stdSolReceiveHistory.operDisabled, "buttonE", true);
    * operVisible：控制按钮是否显示，true代表显示，false代表不显示
    * this.$set(this.stdSolReceiveHistory.operVisible, "buttonE", false);
    */
    if(!currentRow) {
       this.$set(this.sysRoleUsers.operDisabled, "buttonD", true);//删除(D)

    }else {
       this.$set(this.sysRoleUsers.operDisabled, "buttonD", false);//删除(D)

    }
},
selectRoleUser_dialogCancel:function(){
     this.selectRoleUser.visible = false;
},
sysRoles_load:function() {
    let that = this;
    HttpApi.queryDs("platformRole.roles", this.sysRoles.operData, function(res) {
        that.sysRoles.data = res;
        if (that.sysRoles.data.length > 0) {
            that.$refs.sysRoles.setCurrentRow(that.sysRoles.data[0]);
            that.sysRoles_operCtrl(that.sysRoles.data[0]);
        } else {
            that.$refs.sysRoles.setCurrentRow();
            that.sysRoles_operCtrl();
        }
    });
},
sysRoleMenus_allowDrop:function(draggingNode, dropNode, type){
    /*拖拽时判定目标节点能否被放置。
    type ：'prev'、'inner' 和 'next'，
    分别表示放置在目标节点前、插入至目标节点和放置在目标节点后*/
},
sysRoles_sysRolesDel:function(){
    let that = this;
    let id=this.sysRoles.currentRow.id;
    if(id){
        HttpApi.delProviderConfirm("sysRoles", this.sysRoles.currentRow,function(res){
             let index = that.sysRoles.data.findIndex(function(item){
                 return item.id==id;
             });
             that.sysRoles.data.splice(index,1);
             if(that.sysRoles.data.length==0){
                 that.$data.sysRoles.currentRow = that.$options.data().sysRoles.currentRow;
             }else if(that.sysRoles.data.length>index){
                 that.$refs.sysRoles.setCurrentRow(that.sysRoles.data[index]);
             }else{
                 that.$refs.sysRoles.setCurrentRow(that.sysRoles.data[index-1]);
             }
             that.$message.success("删除成功");
        });
    }else{
       this.$alert("请选择要删除的数据");
    }
}
,
sysRoles_editAddSysRole:function() {
    let that = this;
    this.addSysRole.editorForm = true;
    if (!this.sysRoles.currentRow.id) {
        this.$alert("请先选中一条角色清单信息");
        return;
    }
    
    if (this.sysRoles.currentRow.isPublic == 'Y') {
        this.$alert("公共角色不可编辑");
        return;
    }

    this.addSysRole_dialogOpen(this.sysRoles.currentRow, function(dialogData) {
        HttpApi.saveProvider("sysRoles", dialogData, function(res) {
            let index = that.sysRoles.data.findIndex(function(item) {
                return item.id == res.id;
            });
            that.$set(that.sysRoles.data, index, res);
            that.$refs.sysRoles.setCurrentRow(res);
            that.$message.success("操作成功！");
            that.addSysRole.visible = false;
        });
    })
},
appRoleMenus_allowDrop:function(draggingNode, dropNode, type){
    /*拖拽时判定目标节点能否被放置。
    type ：'prev'、'inner' 和 'next'，
    分别表示放置在目标节点前、插入至目标节点和放置在目标节点后*/
},
addSysRole_load:function(){
    let that = this;
    HttpApi.queryObject("sysRoles",this.addSysRole.operData,function(res){
        that.addSysRole.data = res;
    });
},
appRoleMenus_filterNodeMethod:function(value, data){
    if (!value) return true;
    return data.label.indexOf(value) !== -1;
},
sysRoles_operCtrl:function(currentRow) {
    /**
    * operDisabled：控制按钮的是否禁止操作，true代表禁止操作，false代表允许操作
    * this.$set(this.stdSolReceiveHistory.operDisabled, "buttonE", true);
    * operVisible：控制按钮是否显示，true代表显示，false代表不显示
    * this.$set(this.stdSolReceiveHistory.operVisible, "buttonE", false);
    */
    if(!currentRow) {
       this.$set(this.sysRoles.operDisabled, "ele_00116", true);//删除(D)

    }else {
       this.$set(this.sysRoles.operDisabled, "ele_00116", false);//删除(D)

    }
},
selectRoleUser_change:function(fieldName,row){
    HttpApi.updateProvider("sysOrganUsers",fieldName,row,function(){
                        
    });
},
sysRoleUsers_pageCurrentChange:function(currentPage){
    this.sysRoleUsers.pagingData.currentPage=currentPage;
    this.sysRoleUsers_load();
}
,
sysRoles_change:function(fieldName,row){
    let that = this;
    HttpApi.updateProvider("sysRoles",fieldName,row,function(){

    });
}
,
sysRoleMenus_filterNodeMethod:function(value, data){
    if (!value) return true;
    return data.label.indexOf(value) !== -1;
},
selectRoleUser_currentChange:function(currentRow){
    if(!currentRow){
        //如果没有传入值，则将当前的选中值清空
        this.$data.selectRoleUser.currentRow = this.$options.data().selectRoleUser.currentRow;
    }else{
        this.selectRoleUser.currentRow = currentRow;
    }
    this.selectRoleUser_operCtrl(currentRow);
},
selectRoleUser_dialogOpen:function(param,callback){
    this.$data.selectRoleUser.data = this.$options.data().selectRoleUser.data;
    this.$data.selectRoleUser.operData = this.$options.data().selectRoleUser.operData;
    this.$data.selectRoleUser.currentRow = this.$options.data().selectRoleUser.currentRow;
    for(let val in param) {
        this.$set(this.selectRoleUser.operData, val, param[val])
    }
    this.selectRoleUser.callback=callback;
    this.selectRoleUser.visible = true;
    this.selectRoleUser_load();
}
,
sysRoles_openAddSysRole:function(){
    let that = this;
    this.addSysRole.editorForm = false;
    let param = {};
    this.addSysRole_dialogOpen(param,function(dialogData){
       
        HttpApi.saveProvider("sysRoles",dialogData,function(res){
            that.$message.success("操作成功！");
            that.sysRoles.data.push(res);
            that.$refs.sysRoles.setCurrentRow(res);
            that.addSysRole.visible = false;
        });
    })
},
selectRoleUser_load:function() {
    let that = this;
    let param = {};
    param.pagingData = this.selectRoleUser.pagingData;
    param.operData = this.selectRoleUser.operData;

    HttpApi.queryDs("platformRole.queryNotInRoleUser", param, function(res) {
        that.selectRoleUser.pagingData = res.pagingData;
        that.selectRoleUser.data = res.data;
        if (that.selectRoleUser.data.length > 0) {
            that.$refs.selectRoleUser.setCurrentRow(that.selectRoleUser.data[0]);
            that.selectRoleUser_operCtrl(that.selectRoleUser.data[0]);
        } else {
            that.$refs.selectRoleUser.setCurrentRow();
            that.selectRoleUser_operCtrl();
        }
    });
},
sysRoleMenus_currentChange: function(data,node){
    if(data){
        this.sysRoleMenus.currentNodeKey=data.id;
        this.sysRoleMenus.currentRow = data;
        
    }else{
        this.$data.sysRoleMenus.currentNodeKey=this.$options.data().sysRoleMenus.currentNodeKey;
        this.$data.sysRoleMenus.currentRow = this.$options.data().sysRoleMenus.currentRow;
        
    }
},
sysRoleMenus_check:function(node,list){

}
,
sysRoleUsers_pageSizeChange:function(pageSize){
    this.sysRoleUsers.pagingData.pageSize=pageSize;
    this.sysRoleUsers_load();
}
,
appRoleMenus_currentChange:function(data,node){
    let that = this;
    this.appRoleMenus.currentNodeKey=data.id;
    this.appRoleMenus.currentRow=data;
},
selectRoleUser_operCtrl:function(currentRow) {
    /**
    * operDisabled：控制按钮的是否禁止操作，true代表禁止操作，false代表允许操作
    * this.$set(this.selectRoleUser.operDisabled, "buttonE", true);
    * operVisible：控制按钮是否显示，true代表显示，false代表不显示
    * this.$set(this.selectRoleUser.operVisible, "buttonE", false);
    */
    if(!currentRow) {
       
    }else {
       
    }
},
addSysRole_dialogOpen:function(param,callback){
    this.$data.addSysRole.data = this.$options.data().addSysRole.data;
    for(let val in param) {
        this.$set(this.addSysRole.data, val, param[val])
    }
    this.addSysRole.callback=callback;
    this.addSysRole.visible = true;
}
,
sysRoleMenus_operCtrl:function(isPublic) {
    /**
     * operDisabled：控制按钮的是否禁止操作，true代表禁止操作，false代表允许操作
     * this.$set(this.stdSolReceiveHistory.operDisabled, "buttonE", true);
     * operVisible：控制按钮是否显示，true代表显示，false代表不显示
     * this.$set(this.stdSolReceiveHistory.operVisible, "buttonE", false);
     */
    this.$set(this.sysRoleMenus.operDisabled, "ele_00111", isPublic); 
},
sysRoleUsers_currentChange:function(currentRow){
    let that = this;
    if(!currentRow){
        //如果没有传入值，则将当前的选中值清空
        this.$data.sysRoleUsers.currentRow = this.$options.data().sysRoleUsers.currentRow;
    }else{
        this.sysRoleUsers.currentRow = currentRow;
    }
},
sysRoleMenus_save:function(param) {
    let that = this;
    if (!this.sysRoles.currentRow.id) {
        this.$alert("没有对应的角色");
        return;
    }
    let checkedKeys = this.$refs.sysRoleMenus.getCheckedKeys();

    HttpApi.post("/platform/roles/saveRoleMenus", {
        "roleId": this.sysRoles.currentRow.id,
        "checkedKeys": checkedKeys
    }, function(res) {
        /*请补充方法信息*/
        that.$message.success("保存成功！");
    });
},
appRoleMenus_check:function(node,list){

}

},
            mounted: function(){
    dragControllerLR();
    dragControllerUD();
},
            created: function(){
    let that=this;
    //获取字典信息
    HttpApi.dictOptions(["userStatus"],function(res){
        that.dictOptions=res;
    });

    //加载自定义数据字典
    

    //加载初始化load
    this.sysRoles_load();


    //加载初始化方法
    
}
    });
    

    
</script>
</html>
